<?php
$params = array_merge(
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php'),
    require(__DIR__ . '/error.php')
);

return array_merge(
    [
    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    'language' => 'zh-CN',
    'timeZone' => 'Asia/Shanghai',
    // 'modules' => [],
    'components' => [
        'user' => [
            'identityClass' => 'backend\models\AdminModel',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
        ],
        'cache' => [ 
            'class' => 'yii\caching\FileCache', 
            'cachePath' => '@runtime/cache2', 
        ],
        'request' => [
            'csrfParam' => '_csrf-backend',
        ],
        'db' =>require __DIR__.'/db.php', 
        'session' => [
            'name' => 'advanced-backend',
            'timeout'=>3600*2,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,//隐藏index.php
            'enableStrictParsing' => false,
             //'suffix' => '.html',//后缀，如果设置了此项，那么浏览器地址栏就必须带上.html后缀，否则会报404错误
            'rules' => [
            ],
        ],
    ],
    'params' => $params,
]);
